package com.hrbxlh.dao;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import com.hrbxlh.pojo.ReOnlineClass;
import org.springframework.stereotype.Repository;

@Repository
public interface QuestionDao {

	/**
	 * @description 题库列表
	 * @return
	 * @throws Exception
	 * @tips 1027 xzx修改多加了courseList参数，以及多加了course表的表连接，为了查询课程名
	 */
	 List<Map<String,Object>> getAllQuestionList(Map<String, Object> paramMap) throws Exception;

	/**
	 * 添加问题。
	 * @throws IOException
	 */
	 boolean addQuestion(List<Map<String,Object>> list) throws Exception;

	/**
	 * 编辑问题。
	 * @throws IOException
	 */
	 boolean saveQuestion(Map<String,Object> paramMap) throws Exception;

	/**
	 * @description 删除题库
	 * @param List<Integer> 题库id的集合
	 * @return
	 * @throws Exception
	 */
	 boolean delQuestions(List<String> paramList) throws Exception;

	/**
	 * @description 题库单选择excel
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getOptionQuestionListExcel(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 题库多选择excel
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getManyOptionQuestionListExcel(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 题库判断excel
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getJudgeQuestionListExcel(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 题库填空excel
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getBlanksQuestionListExcel(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 题库简答excel
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getAnswerQuestionListExcel(Map<String, Object> paramMap) throws Exception;

	/**
	 * 在线预览表单提交。
	 * @throws IOException
	 */
	 boolean addOnlineQuestion(Map<String,Object> paramMap) throws Exception;

	/**
	 * 在线预览表单提交(修改)。
	 * @throws IOException
	 */
	 boolean updateOnlineQuestion(Map<String,Object> paramMap) throws Exception;

	/**
	 * 修改此试卷对应所有复制的试卷
	 * @throws IOException
	 */
	 boolean updateCopyOnlineQuestion(Map<String,Object> paramMap) throws Exception;

	/**
	 * @description 通过学号和课程号获取此学生所属老师，查出当前科目当前老师生成的试题
	 * @return
	 * @throws Exception
	 */
	 Map<String,Object> getOnlineQuestion(Map<String, Object> paramMap) throws Exception;

	/**
	 * 学生在线考试表单提交
	 * @throws IOException
	 */
	 boolean addStuAnswerQuestion(Map<String,Object> paramMap) throws Exception;

	/**
	 * 学生在线考试表单自动保存
	 * @throws IOException
	 */
	 boolean stuOnlineAutomaticSaveExam(Map<String,Object> paramMap) throws Exception;

	/**
	 * 学生在线考试表单自动保存（更新操作）
	 * @throws IOException
	 */
	 boolean stuUpdateOnlineAutomaticSaveExam(Map<String,Object> paramMap) throws Exception;

	/**
	 * @description 通过onlinequestionId和stuorteaId查询学生信息是否已经保存
	 * @return
	 * @throws Exception
	 */
	 Map<String,Object> getStuOnlineInfoById(Map<String,Object> paramMap) throws Exception;

	/**
	 * 学生在线考试表单提交(修改)
	 * @throws IOException
	 */
	 boolean updateStuAnswerQuestion(Map<String,Object> paramMap) throws Exception;

	/**
	 * @description 通过问题主键查询question表查每道题的答案
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getAllQuestionListById(List<Map<String,Object>> list) throws Exception;

	/**
	 * @description 该教师的当前所属的所有班级学生考试情况
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getAllStuExamList(Map<String,Object> map) throws Exception;

	/**
	 * @description 通过课程id和学号查询当前课程的试题
	 * @return
	 * @throws Exception
	 */
	 Map<String,Object> getMarkStuQuestion(Map<String,Object> map) throws Exception;

	/**
	 * 编辑成绩表，将学生总成绩插入数据库。
	 * @throws IOException
	 */
	 boolean saveQuestionByStuId(Map<String,Object> paramMap) throws Exception;

	/**
	 * 编辑学生在线考试表，将填空、简答的错误数量和分数插入数据库。
	 * @throws IOException
	 */
	 boolean addExameSource(Map<String,Object> paramMap) throws Exception;

	/**
	 * 将教师批阅完的试卷名称插入stuanswerquestion表里。
	 * @throws IOException
	 */
	 boolean updateFileStuqustion(Map<String,Object> paramMap) throws Exception;


	/**
	 * @description 通过学号和试卷主键查询当前学生是否已经答过题
	 * @return
	 * @throws Exception
	 */
	 Map<String,Object> getStuAnswerByOnIdAndCouId(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 通过课程名查询试题
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getQuestionByName(Map<String,Object> questionMap) throws Exception;

	/**
	 * @description 删除试卷
	 * @param List<Integer> 试卷id的集合
	 * @return
	 * @throws Exception
	 */
	 boolean delOnlineQuestion(List<Map<String,Object>> paramList) throws Exception;

	/**
	 * @description 删除试卷对应学生答题
	 * @param List<Integer> 试卷id的集合
	 * @return
	 * @throws Exception
	 */
	 boolean delStuanswerByOnlineQuestion(List<Map<String,Object>> paramList) throws Exception;

	/**
	 * @description 删除re_online_class表
	 * @param List<Integer> 试卷id的集合
	 * @return
	 * @throws Exception
	 */
	 boolean delReOnlineClassQuestion(List<Map<String,Object>> paramList) throws Exception;

	/**
	 * @description 通过试卷主键查询试卷是否有学生已经答过题
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getStuAnswerByOnIdList(List<Map<String,Object>> paramList) throws Exception;

	/**
	 * @description 通过试卷主键查询试卷是否有学生已经答过题
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getStuAnswerByOnIdListObject(List<Map<String,Object>> paramList) throws Exception;

	/**
	 * @description 通过问题主键查询question表查每道题的文件名
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getAllFileNameListById(List<String> list) throws Exception;

	/**
	 * @description 查询要复制试卷对应的班级是否已经考过试
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getAllArealdyExamCopyClassList(Map<String,Object> map) throws Exception;
	/**
	 * @description 教师点击开始考试
	 * @param  试卷id
	 * @return
	 * @throws Exception
	 */
	 boolean updateOnlineState(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 查询数据库中是否存在因重启服务导致定时任务没有走，考试没有结束的数据
	 * @param
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getZData(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 通过onlinequestionId查试卷
	 * @return
	 * @throws Exception
	 */
	 Map<String,Object> getStartTimeByOnId(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 将没有提交试卷的学生自动提交
	 * @param  试卷id,学号stuorteaId,state 1
	 * @return
	 * @throws Exception
	 */
	 boolean addNoExamStuAnswerQuestion(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 更改试卷名
	 * @param  试卷id,文件名
	 * @return
	 * @throws Exception
	 */
	 boolean updateFileName(List<Map<String, Object>> list) throws Exception;

	/**
	 * @description 通过courseId查onlinequestion
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getOnlineQuestionByOnCourseId(Map<String, Object> paramMap) throws Exception;

	/**
	 * 复制试卷的添加。
	 * @throws IOException
	 */
	 boolean addCopyOnlineQuestion(Map<String,Object> paramMap) throws Exception;

	/**
	 * @description 通过被复制的试卷id查询复制好的试卷id
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getAllCopyQuIdList(Map<String,Object> map) throws Exception;

	/**
	 * 在线预览表单提交(只修改考试)。
	 * @throws IOException
	 */
	 boolean updateOnlineQuestionOnly(Map<String,Object> paramMap) throws Exception;

	/**
	 * 修改此试卷对应所有复制的试卷只有试卷名和考试时间可以修改
	 * @throws IOException
	 */
	 boolean updateCopyOnlineQuestionOnly(Map<String,Object> paramMap) throws Exception;

	/**
	 * @description 删除班级对应的试卷
	 * @param  list[classId]
	 * @return
	 * @throws Exception
	 */
	 boolean deleteOnlineByClassIdAndOnId(Map<String, Object> map) throws Exception;


	 Map<String,Object> getOnlineQuestionByFileName(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 将考试班级插入数据库
	 * @param  list[classId]
	 * @return
	 * @throws Exception
	 */
	 boolean addreClassOnline(Map<String, Object> map) throws Exception;

	/**
	 * @description 查询当前课程所要考试的班级是否已经是考试状态
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getreClassOnlineStateByCourseId(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 教师点击开始考试，修改被复制试卷的考试状态
	 * @param  试卷id
	 * @return
	 * @throws Exception
	 */
	 boolean updateCopyOnlineState(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 修改考试状态
	 * @param  onlinequestionId
	 * @return
	 * @throws Exception
	 */
	 boolean updatereClassOnline(Map<String, Object> map) throws Exception;

	/**
	 * @description 修改考试状态---将数据库中的脏数据全部变为考试结束（因重启服务没有走定时任务导致考试时间已经到但是没有结束）
	 * @param  onlinequestionId
	 * @return
	 * @throws Exception
	 */
	 boolean updateZreClassOnline(Map<String, Object> map) throws Exception;

	/**
	 * @description 批量更改考试班级状态
	 * @param  onlinequestionId
	 * @return
	 * @throws Exception
	 */
	 boolean updateManyClassOnline(Map<String, Object> map) throws Exception;

	/**
	 * @description 删除没有与试卷关联的班级（onlinequestionId为0的）
	 * @param  list[classId]
	 * @return
	 * @throws Exception
	 */
	 boolean delreClassOnlineByOnId(Map<String, Object> map) throws Exception;

	/**
	 * @description 删除没有与试卷关联的班级（onlinequestionId为0的）
	 * @param  list[classId]
	 * @return
	 * @throws Exception
	 */
	 boolean delreClassOnlineByOnIdList(Map<String, Object> map) throws Exception;

	/**
	 * @description 通过课程id和教师id删除试卷与班级的关联
	 * @param  list[classId]
	 * @return
	 * @throws Exception
	 */
	 boolean delreClassOnlineByCouId(Map<String, Object> map) throws Exception;

	/**
	 * @description 将教师和班级添加到re_online_class
	 * @param  classId  teaId
	 * @return
	 * @throws Exception
	 */
	 boolean addreClassOnlineByClassAndTeaId(Map<String, Object> map) throws Exception;


	/**
	 * @description 通过试卷主键id集合删除试卷对应学生答题
	 * @param List<Integer> 试卷id的集合
	 * @return
	 * @throws Exception
	 */
	 boolean delStuanswerByOnlineId(List<Map<String, Object>> paramList) throws Exception;

	/**
	 * @description 通过试卷主键id删除试卷对应学生答题
	 * @param List<Integer> 试卷id的集合
	 * @return
	 * @throws Exception
	 */
	 boolean delStuanswerByOnlineIdTwo(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 查询当前教师是否已存在班级的关联
	 * @return
	 * @throws Exception
	 */
	 List<ReOnlineClass> getreClassOnlineByTeaIdAndClaId(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 将教师和班级添加到re_online_class 批量插入关联表中
	 * @param  classId  teaId
	 * @return
	 * @throws Exception
	 */
	 boolean addreClassOnlineByListId(Map<String, Object> map) throws Exception;

	/**
	 * @description 将教师和班级添加到re_online_class 批量插入关联表中
	 * @param  classId  teaId
	 * @return
	 * @throws Exception
	 */
	 boolean addreClassOnlineTwo(Map<String, Object> map) throws Exception;

	/**
	 * @description 修改班级的考试状态
	 * @param  classId
	 * @return
	 * @throws Exception
	 */
	 boolean updatereClassOnlineState(Map<String, Object> map) throws Exception;

	/**
	 * param courseId
	 * @description 查询当前课程学生是否已经考过试
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getAealdyExamList(Map<String, Object> paramMap) throws Exception;


	/**
	 * param courseId
	 * @description 查询当前课程当前班级是否已经考试
	 * @return
	 * @throws Exception
	 */
	List<Map<String,Object>> getAealdyExamCourseList(Map<String, Object> paramMap) throws Exception;


	/**
	 * @description 删除试卷对应学生答题
	 * @param List<Map<String, Object>> 试卷id的集合
	 * @return
	 * @throws Exception
	 */
	 boolean delStuanswerByOnlineQuestionId(List<Map<String, Object>> paramList) throws Exception;

	/**
	 * @description 清空考试成绩、总成绩
	 * @param List<Map<String, Object>> 学生id的集合、课程id
	 * @return
	 * @throws Exception
	 */
	 boolean clearExamSource(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 清空考试成绩、总成绩
	 * @param List<Map<String, Object>> 学生id的集合、课程id
	 * @return
	 * @throws Exception
	 */
	 boolean updatOnlineRepatMark(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 查询当前班级状态时考试中的集合
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getExamingClassList(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 将这些班级的其他试卷中班级的状态改为考试中
	 * @param List<Map<String, Object>> 班级id的集合、课程id、教师id
	 * @return
	 * @throws Exception
	 */
	 boolean updateClassState(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 查询要考试的班级中是否有状态是正常考试的状态(作用是，当一个课正在考试，不可以在给当前班级分配其他课程开始考试)
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getifHaveingExamingClassList(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 这个教师这个课存在的试卷是否还存在与班级有关联关系
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getreClassOnlineByTeaId(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 将这个课的这个教师的这个试卷删除
	 * @param Map<String, Object> 试卷主键、课程id、教师id
	 * @return
	 * @throws Exception
	 */
	 boolean delOnlineByTeaId(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 通过试卷主键查询学生集合
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getStuIdListByOnId(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 通过这个教师这个课程教的所有班级查询试卷与班级关联表中班级的状态
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getClassStateByClassIdList(Map<String, Object> paramMap) throws Exception;

	/**
	 * @description 查询要被覆盖的试卷集合
	 * @param
	 * @return
	 * @throws Exception
	 */
	 List<Map<String,Object>> getRequireRepatOnlinequestionList(Map<String, Object> paramMap) throws Exception;

}
